package com.logic.utils

import io.reactivex.functions.Function
import java.lang.Exception
import java.util.ArrayList
import java.util.regex.Pattern
import kotlin.Pair

object ErrorMessageHandle {
    val Handle30083 = Function<String, Pair<String, ArrayList<String>>> { s ->
        val numberP = Pattern.compile("^(\\D*！).*")
        val numberM = numberP.matcher(s)
        val numberS: String = if (numberM.find()) {
            numberM.group(1)
        } else {
            ""
        }
        val codeP =
            Pattern.compile("\\D*([0-9A-Z]+ [0-9A-Z]+ [0-9A-Z]+ [0-9A-Z]+ [0-9A-Z]+ [0-9A-Z]+)\\D*")
        val codeM = codeP.matcher(s)
        val codeList = ArrayList<String>()
        while (codeM.find()) {
            codeList.add(codeM.group(1))
        }
        Pair(numberS, codeList)
    }
}